<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title> 订单列表 </title>

<?php include VIEWS.'admin/style.html'?>

<script type="text/javascript">
<!--
function toggleClassNames() {
  var n = this.className;
  this.className = this.altClassName;
  this.altClassName = n;
}

function setupDatarows() {
  var v = document.getElementsByTagName("tr");
  for (var i = 0; i < v.length; i++) {
    if (v[i].className.indexOf("datarow") != -1) {
      v[i].onmouseover = toggleClassNames;
      v[i].onmouseout = toggleClassNames;
      v[i].altClassName = v[i].className + " hover";
    }
  }
}

window.onload = setupDatarows;
//-->
</script>

</head>

<body>

<?php include VIEWS.'admin/head.html'?>

<ul id="submenu">
	<li><a href='indents.php'<?php if(!$_GET['show']):?> class="current"<?php endif?>>待处理订单</a></li>
	<li><a href='indents.php?show=all'<?php if($_GET['show']=='all'):?> class="current"<?php endif?>>所有订单</a></li>
	<li><a href='indents.php?show=archive'<?php if($_GET['show']=='archive'):?> class="current"<?php endif?>>存档订单</a></li>
</ul>

<div id="body">

<div style="width:98%" align="right"><form method="get"><input type="hidden" name="sort" value="<?php echo $data['sort']?>"><input type="text" name="s" value="<?php echo $data['search']?>"> <input type="submit" value="查询">&nbsp;<a href="indents.php?sort=<?php echo $data['sort']?>"><small>清除搜索</small></a></form></div>

<br clear="all" />

<table class="reportV2" cellpadding="5" width="98%" cellspacing="0">
<tr class="columntitle"><td width="5%" nowrap=""><a href="indents.php?sort=id&s=<?php echo $data['search']?>&archive=<?php echo $data['archive']?>">订单号</a></td><td nowrap><a href="indents.php?sort=username&s=<?php echo $data['search']?>&archive=<?php echo $data['archive']?>">收货人</a></td><td>收货地址</td><td>电话</td><td><a href="indents.php?sort=created&s=<?php echo $data['search']?>&archive=<?php echo $data['archive']?>">订单/更新时间</a></td><td><a href="indents.php?sort=sumfee&s=<?php echo $data['search']?>&archive=<?php echo $data['archive']?>">金额</a></td><td><a href="indents.php?sort=stat&s=<?php echo $data['search']?>&archive=<?php echo $data['archive']?>">状态</a></td><td>操作</td></tr>

<?php if (count($list['list'])==0):?><tr><td colspan="9" style="text-align:left">没有找到相关订单<td></tr><?php endif;?>

<?php foreach($list['list'] as $item):
$userslist_i++;
?>
<tr class="<?php echo ($userslist_i % 2 ==0) ? 'even' : 'odd'?> datarow"><td><b><?php echo $item['id']?></b><td><?php if($item['uid']):?><b><a href="usersedit.php?id=<?php echo $item['uid']?>" title="<?php echo $item['memo']?>"><?php endif; echo $item['linkman']; if($item['uid']):?></a></b><?php endif?></td><td><?php echo $item['address']?></td><td><?php echo $item['tel']?></td><td nowrap><small><font color="green"><?php echo date('m-d H:i',$item['created'])?></font> / <font color="blue"><?php echo date('m-d H:i',$item['updated'])?></font></small></td><td nowrap><font color="blue">&yen; <?php echo $item['sumfee']+$item['postfee']+$item['adjustfee']?></font></td><td nowrap>
<?php
switch($item['stat']) {
    case -1:        echo '<font color="#CCCCCC"><b>已存档</b></font>'; break;
    case 1:         echo '<font color="red"><b>已支付</b></font>'; break;
    case 2:         echo '<font color="green"><b>等待发货</b></font>'; break;
    case 3:         echo '<font color="blue"><b>已发货</b></font>'; break;
    case 4:         echo '<font color="#CCCCCC"><b>订单完成</b></font>'; break;
    case 0:default: echo '未支付';
}
?>
</td><td nowrap><a href="indentsedit.php?id=<?php echo $item['id']?>&p=<?php echo $list['page']['p']?>"><b>查看/修改</b></a><?php if($_GET['show']=='archive'):?> - <a href="javascript:cRedirect('indentsedit.php?id=<?php echo $item['id']?>&remove=1&fromurl=<?php echo urlencode($_SERVER['REQUEST_URI'])?>','确认要删除订单 “<?php echo $item['id']?>” 吗？');">删除</a><?php endif?></td></tr>
<?php endforeach;?>
</table>

<?php include VIEWS.'admin/pages.html'?>
<?php include VIEWS.'admin/runtime.html'?>

</div>

<script type="text/javascript">
Element.addClassName('am2', 'current');
</script>

</body>
</html>
